//
//  FMListCell.m
//  宝宝儿歌
//
//  Created by Clement_Gu on 16/4/25.
//  Copyright © 2016年 baobaoerge. All rights reserved.
//

#import "FMListCell.h"

@implementation FMListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
//重写cell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
       
        [self buildAllControls];
        
        
    }
    return self;
}
/**
 *  创建单元格内容
 */
-(void)buildAllControls
{
    //设置image
    UIImageView *imageView = [[UIImageView alloc]init];
    //设置图片外观
    imageView.layer.cornerRadius = 30;
    imageView.layer.borderWidth = 1;
    imageView.layer.borderColor = [UIColor orangeColor].CGColor;
    //切割多余部分
    imageView.layer.masksToBounds = YES;
    //设置图片样式
    imageView.contentMode = UIViewContentModeScaleToFill;
    //添加
    self.imgView = imageView;
    //frame后面设置
    [self.contentView addSubview:imageView];

//    设置label
    UILabel *labelName = [[UILabel alloc]init];
    labelName.font = [UIFont boldSystemFontOfSize:15];
    [labelName sizeToFit];
    labelName.numberOfLines = 0;
    self.nameLabel = labelName;
    [self.contentView addSubview:labelName];

}

/**
 *  布局
 */
-(void)layoutSubviews
{
    [super layoutSubviews];
    self.imgView.frame = CGRectMake(1, 1, 58, 58);
    self.nameLabel.frame = CGRectMake(65, 0, self.bounds.size.width-65, self.bounds.size.height) ;

}













- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
